<form id="<?php echo $uniqid;?>" method="post" style="padding: 8px;">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td class="tlabel">标题：</td>
            <td width="80%"><input type="text" style="width:400px;" v-model="params.title"
                                   class="forminput inputstyle textbox-text validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入标题.." required="true"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel">关键词：</td>
            <td width="80%"><input type="text" style="width:400px;" v-model="params.keywords"
                                   class="forminput inputstyle textbox-text validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入关键词.." required="true"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel">状态：</td>
            <td width="80%">
                <label style="margin-right:20px;"><input type="radio" v-model="params.status" value=1>显示</label>
                <label><input type="radio" v-model="params.status" value=0>隐藏</label>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td colspan="2">
                <script id="pageseditEditor" name="content" type="text/plain">{{ params.content }}</script>
            </td>
        </tr>
    </table>
</form>

<script>
    var pageseditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
        },
        methods: {
            submit: function () {
                this.params.content= pageseditUm.getContent();
                let act = this.params.id ? 'edit' : 'add';
                $.post('/admin/pages/' + act, pageseditVm.params, function (data) {
                    if (data.ret === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $('#<?php echo $uniqid;?>').form('clear');
                        $("#pagesDlg").dialog('close');
                        pagesReload();
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    if (typeof(pageseditUm) != 'undefined') {
        pageseditUm.destroy();
    }
    var pageseditUm = UE.getEditor('pageseditEditor', {initialFrameHeight: 400, autoHeightEnabled: false});
    $(function () {
        $('#pagessubmit').click(function (data) {
            pageseditVm.submit();
        });
    });
</script>
